{% extends "staff/base.html" %}
{% import 'staff/_formhelpers.html' as forms %}

{% block title %} {{ client.name }} OAuth Client {% endblock %}

{% block main %}
<section class="content-header">
  <h1> {{ client.name }} OAuth Client </h1>
  <ol class="breadcrumb">
    <li><a href="{{ url_for('.index') }}"><i class="fa fa-dashboard"></i> Home</a></li>
    <li><a href="{{ url_for('.clients') }}"><i class="fa fa-list"></i>OAuth Clients</a></li>
    <li><a href=""><i class="fa fa-edit"></i>{{ client.name }}</a></li>
  </ol>
</section>

  <section class="content">
    {% include 'alerts.html' %}
      <div class="row">
              <div class="col-md-12">
                  <div class="box">
                    <div class="box-header">
                      <h3 class="box-title">Update OAuth Client</h3>
                    </div>
                    <div class="box-body">
                    {% call forms.render_form(form, action_url="", action_text='Update OAuth Client', class_='form') %}
                      {{ forms.render_field(form.name, label_visible=true, placeholder='Ok Client', type='text') }}
                      {{ forms.render_field(form.owner, label_visible=true, placeholder='Owner Email', type='text') }}
                      {{ forms.render_field(form.description, label_visible=true, placeholder='A client for OK', type='text') }}
                      {{ forms.render_field(form.client_id, label_visible=true, placeholder='ok-client', type='text') }}
                      {{ forms.render_checkbox_field(form.roll_secret, label_visible=true) }}
                      <!-- Client Secret is not rendered -->
                      {{ forms.render_checkbox_field(form.is_confidential, label_visible=true) }}
                      {% if current_user.is_admin %}
                      {{ forms.render_checkbox_field(form.active, label_visible=true) }}
                      {% endif %}
                      {{ forms.render_field(form.redirect_uris, placeholder='http://localhost:8000/authorized,https://cs61a.org/oauth/authorized', label_visible=true) }}
                      {% if current_user.is_admin %}
                      {{ forms.render_field(form.default_scopes, placeholder='email,all', label_visible=true) }}
                      {% endif %}

                    {% endcall %}
                 </div>
             </div>
           </div>
</div>

    </section>


{% endblock %}
